<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/webCommon/webCommon.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>学院添加</title>
<!-- 默认选中学院名称-开始 -->
<script type="text/javascript" >
 $(document).ready(function(){
		$(".college").each(function(){//循环获取所有单位编号 
			var collegeId = $(this).attr("value");
			var college = $("#sysMarjorsCollegeId").attr("value");
			if(collegeId == college){
				$(this).attr("selected","selected");				
		}	
		});
	 });
</script>
<!-- 默认选中学院名称-结束 -->
<script type="text/javascript" src="plugins/layui/layui.js"></script>
		<script>
			layui.use(['form', 'layedit', 'laydate'], function() {
				var form = layui.form(),
					layer = layui.layer,
					layedit = layui.layedit,
					laydate = layui.laydate;
				//自定义验证规则
				form.verify({
					collegeId: function(value) {
							if(value.length <= 0) {
								return '没有选择学院捏';
							}
						},
			    	marjorsName: function(value) {
							if(value.length <= 0) {
								return '没有填写专业捏';
							}
						}
				});
				 //监听提交
				form.on('submit(tijiao)', function(data) {
					layer.alert(JSON.stringify(data.field), {
						title: '最终的提交信息'
					})
				});
			});
		</script>

</head>

<body>
	<div class="place">
	    <span>位置：</span>
	    <ul class="placeul">
	    <li><a href="#">首页</a></li>
	    <li><a href="#">专业管理</a></li>
	    <li><a href="#">专业-修改</a></li>
	    </ul>
	    </div>
	    
	<div style="margin: 15px;">
		 <form class="layui-form" action="<%=basePath%>/come/SysMarjors_edit.action">
		 <input name="id"  type="hidden" value="${sysMarjors.id}">
		 <input name="marjorsId"  type="hidden" value="${sysMarjors.marjorsId}">
		 <div class="layui-form-item">
					<label class="layui-form-label">所属学院</label>
					<div class="layui-input-inline">
						<select name="collegeId" id="college" >
							<option value="请选择..."></option>
							<s:iterator value="sysCollegeAllList">
							       <option class="college"  value="${collegeId}" id="${collegeId}">${collegeName}</option>
							</s:iterator>
						</select>
		            </div>
		</div>
			<div class="layui-form-item">
				<label class="layui-form-label">专业名称</label>
				<div class="layui-input-inline">
					<input type="text" name="marjorsName" value="${sysMarjors.marjorsName}" lay-verify="collegeName" autocomplete="off" placeholder="专业名称" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
					<div class="layui-input-block">
						<button id="tijiao" class="layui-btn" lay-filter="tijiao" lay-submit="">立即提交</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
		</form>
		 <input name="sysMarjors.collegeId" type="hidden" id="sysMarjorsCollegeId" value="${sysMarjors.collegeId}"/>  <!-- 用于下拉选择的读取-学院 -->
	</div>
</body>
</html>
